﻿#pragma once

#include <qbytearray.h>
#include <qthread.h>
#include <qlinkedlist.h>
#include <qserialport.h>

class SerialPortManager :public QSerialPort
{
  Q_OBJECT
private:
  enum PrivateSignalClass
  {
    PrivateSignal
  };
private://property
  QThread* qThread=Q_NULLPTR;
public:
  SerialPortManager(/*QObject* parent = Q_NULLPTR*/);
  ~SerialPortManager();
signals:
  void signal_sendData(QByteArray data,PrivateSignalClass privateSignal);//the signal can only emitted by this class
  void signal_dataReceived(QByteArray data,PrivateSignalClass privateSignal);
public:
  bool openSerialPort();
  void sendData(QByteArray data);
  void init();
private slots:
  void slot_sendData(QByteArray data);
  void slot_readData();
};
